package com.wcll.www;
import java.util.*;
import java.sql.*;
public class QiYiBean {
	private int id;
	private String genuiid;
	private String workjaname;
	private String workjaaname;
	private String workaddraprivice;
	private String workaddracity;
	private String workaddracounty;
	private String worksalary;
	private String appraiseyourself;
	private java.util.Date createtime;
	private final int ROWSPAGE = 20;
	private String diqu;
	private static Connection con = null;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getGenuiid() {
		return genuiid;
	}
	public void setGenuiid(String genuiid) {
		this.genuiid = genuiid;
	}
	public String getWorkjaname() {
		return workjaname;
	}
	public void setWorkjaname(String workjaname) {
		this.workjaname = workjaname;
	}
	public String getWorkjaaname() {
		return workjaaname;
	}
	public void setWorkjaaname(String workjaaname) {
		this.workjaaname = workjaaname;
	}
	public String getWorkaddraprivice() {
		return workaddraprivice;
	}
	public void setWorkaddraprivice(String workaddraprivice) {
		this.workaddraprivice = workaddraprivice;
	}
	public String getWorkaddracity() {
		return workaddracity;
	}
	public void setWorkaddracity(String workaddracity) {
		this.workaddracity = workaddracity;
	}
	public String getWorkaddracounty() {
		return workaddracounty;
	}
	public void setWorkaddracounty(String workaddracounty) {
		this.workaddracounty = workaddracounty;
	}
	public String getWorksalary() {
		return worksalary;
	}
	public void setWorksalary(String worksalary) {
		this.worksalary = worksalary;
	}
	public String getAppraiseyourself() {
		return appraiseyourself;
	}
	public void setAppraiseyourself(String appraiseyourself) {
		this.appraiseyourself = appraiseyourself;
	}
	public String getDiqu() {
		return diqu;
	}
	public void setDiqu(String diqu) {
		this.diqu = diqu;
	}
	public java.util.Date getCreatetime() {
		return createtime;
	}
	public void setCreatetime(java.util.Date createtime) {
		this.createtime = createtime;
	}
	public static Connection getCon() throws ClassNotFoundException, SQLException {
		if(con==null){
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost/jobs?useUnicode=true&characterEncoding=UTF8","root","");
		}
		return con;
	}
	public static void setCon(Connection con) {
		QiYiBean.con = con;
	}
	public ArrayList<QiYiBean> getQiuZhiYiXiang(int id){
		ArrayList<QiYiBean> qzal = new ArrayList<QiYiBean>();
		try{
			con = QiYiBean.getCon();
			Statement st = con.createStatement();
			Statement st1 = con.createStatement();
			Statement st2 = con.createStatement();
			Statement st3 = con.createStatement();
			ResultSet rs = st.executeQuery("select * from find_job where user='"+id+"'");
			while(rs.next()){
				QiYiBean qiuyi = new QiYiBean();
				qiuyi.setId(rs.getInt("id"));
				qiuyi.setGenuiid(rs.getString("genui_id"));
				ResultSet rs1 = st1.executeQuery("select ja_name from job_assort where id ="+rs.getString("work_ja_name"));
				String s = "";
				while(rs1.next()){
					s += rs1.getString("ja_name");
				}
				qiuyi.setWorkjaname(s);
				s = "";
				ResultSet rs2 = st2.executeQuery("select jaa_name from job_assort_avatar where ja_id="+rs.getString("work_ja_name")+" and id="+rs.getString("work_jaa_name"));
				while(rs2.next()){
					s+=rs2.getString("jaa_name")+" ";
				}
				qiuyi.setWorkjaaname(s);
				s = "";
				ResultSet rs3 = st3.executeQuery("select name from area where id='"+rs.getString("work_addr_aprivice")+"' or id='"+rs.getString("work_addr_acity")+"' or id='"+rs.getString("work_addr_acounty")+"'");
				while(rs3.next()){
					s+=rs3.getString("name")+" ";
				}
				qiuyi.setDiqu(s);
				qiuyi.setWorksalary(rs.getString("work_salary"));
				qiuyi.setAppraiseyourself(rs.getString("appraise_yourself"));
				qiuyi.setCreatetime(new java.util.Date(rs.getDate("createtime").getTime()));
				qzal.add(qiuyi);
				rs1.close();
				rs2.close();
				rs3.close();
			}
			rs.close();
			st.close();
		}catch(Exception e){}
		return qzal;
	}
}
